package com.wdz.tofsController;


import com.wdz.annotations.ResponseResult;
import com.wdz.annotations.SecureInterception;
import com.wdz.http.Response;
import com.wdz.kafka.Product;
import com.wdz.kafka.constant.Topics;
import com.wdz.kafka.entity.EmailEntity;
import com.wdz.tofs.tofs_menu.entity.TofsMenu;
import com.wdz.tofs.tofs_menu.service.ITofsMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * <p>
 * 资源宝库菜单目录列表 前端控制器
 * </p>
 *
 * @author 吴传逞
 * @since 2021-04-16
 */
@RestController
@RequestMapping("/tofs_menu")
@ResponseResult
public class TofsMenuController {
    @Autowired
    private ITofsMenuService iTofsMenuService;

    //@Autowired
    //private Product product;

    @PostMapping("/")
    public Response post(@RequestBody TofsMenu tofsMenu) throws ExecutionException, InterruptedException {
        iTofsMenuService.insert(tofsMenu);
        return Response.success((Object) tofsMenu.getId());
    }

    @GetMapping("/")
    public List<TofsMenu> get(){
        //product.sendMsg(Topics.EMAILS,"oo","pp");

        return iTofsMenuService.selectList(null);
    }
}

